]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
authPrompt: give message label an initial style
authorRay Strode <rstrode@redhat.com>
Tue, 27 Aug 2013 14:17:26 +0000 (10:17 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 27 Aug 2013 14:20:16 +0000 (10:20 -0400)
This commit consolidates the styles of the various
message types into one 'login-dialog-message' style
and then adds additional styles on top to cover the
differences.

This allows us to give the message label an initial
style so that is padded properly before any messages
are displayed.

https://bugzilla.gnome.org/show_bug.cgi?id=706670

data/theme/gnome-shell.css
js/gdm/authPrompt.js

index 176d4322ec1c3fe815610d19b3621f3aebb5874b..bfb52dc4b7400d2a6970fd88a52c9461e0305771 100644 (file)
@@ -2433,8 +2433,7 @@ StScrollBar StButton#vhandle:active {
     background-color: rgba(102, 102, 102, 0.15);
 }
 
-.login-dialog-message-warning,
-.login-dialog-message-info {
+.login-dialog-message {
     padding-top: 4px;
     padding-bottom: 16px;
     min-height: 2em;
@@ -2445,8 +2444,7 @@ StScrollBar StButton#vhandle:active {
 }
 
 .login-dialog-message-hint {
-    padding-bottom: 16px;
-    min-height: 2em;
+    padding-top: 0px;
 }
 
 .user-widget-label {
index 73763f365ad34bc575a156e37434302367a358d0..90fefcfc35bee78b9d7eb7c908837fd0727a8540 100644 (file)
@@ -36,8 +36,6 @@ const BeginRequestType = {
     DONT_PROVIDE_USERNAME: 1
 };
 
-let _messageStyleMap;
-
 const AuthPrompt = new Lang.Class({
     Name: 'AuthPrompt',
 
@@ -109,7 +107,8 @@ const AuthPrompt = new Lang.Class({
 
         this._entry.grab_key_focus();
 
-        this._message = new St.Label({ opacity: 0 });
+        this._message = new St.Label({ opacity: 0,
+                                       styleClass: 'login-dialog-message' });
         this._message.clutter_text.line_wrap = true;
         this.actor.add(this._message, { x_fill: true, y_align: St.Align.START });
 
@@ -371,27 +370,22 @@ const AuthPrompt = new Lang.Class({
                          });
     },
 
-    _initMessageStyleMap: function() {
-        if (_messageStyleMap)
-            return;
-
-        _messageStyleMap = {};
-        _messageStyleMap[GdmUtil.MessageType.NONE] = '';
-        _messageStyleMap[GdmUtil.MessageType.ERROR] = 'login-dialog-message-warning';
-        _messageStyleMap[GdmUtil.MessageType.INFO] = 'login-dialog-message-info';
-        _messageStyleMap[GdmUtil.MessageType.HINT] = 'login-dialog-message-hint';
+    setMessage: function(message, type) {
+        if (type == GdmUtil.MessageType.ERROR)
+            this._message.add_style_class_name('login-dialog-message-warning');
+        else
+            this._message.remove_style_class_name('login-dialog-message-warning');
 
-    },
+        if (type == GdmUtil.MessageType.HINT)
+            this._message.add_style_class_name('login-dialog-message-hint');
+        else
+            this._message.remove_style_class_name('login-dialog-message-hint');
 
-    setMessage: function(message, type) {
-        this._initMessageStyleMap();
         if (message) {
             Tweener.removeTweens(this._message);
             this._message.text = message;
-            this._message.styleClass = _messageStyleMap[type];
             this._message.opacity = 255;
         } else {
-            this._message.styleClass = null;
             this._message.opacity = 0;
         }
     },